'ok', 'warning', 'delayed', 'degraded', 'pending', 'partial' => 'warn', 'offline', 'critical', 'blocked', 'failed' => 'bad', default => 'neutral', }; } function avg(array $values): float { $values = array_filter($values, fn($v) => is_numeric($v)); if (count($values) === 0) { return 0.0; } return array_sum($values) / count($values); } function clamp(float $value, float $min, float $max): float { return max($min, min($max, $value)); } /* --------------------------------- DEFAULT DATA --------------------------------- */ $defaultProjects = [ 'projects' => [ [ 'name' => 'SIMON Intelligence Core', 'owner' => 'Keith', 'status' => 'active', 'priority' => 'high', 'completion' => 74, 'budget' => 18000, 'spent' => 9200, 'due_date' => '2026-04-15', 'phase' => 'Core Platform', 'todos_open' => 12, 'todos_done' => 34, ], [ 'name' => 'WEB360 Studio', 'owner' => 'Keith', 'status' => 'active', 'priority' => 'high', 'completion' => 68, 'budget' => 24000, 'spent' => 11750, 'due_date' => '2026-05-10', 'phase' => 'Builder Engine', 'todos_open' => 18, 'todos_done' => 29, ], [ 'name' => 'SIMON Social', 'owner' => 'Keith', 'status' => 'warning', 'priority' => 'medium', 'completion' => 38, 'budget' => 12000, 'spent' => 4100, 'due_date' => '2026-05-28', 'phase' => 'Social Automation', 'todos_open' => 21, 'todos_done' => 9, ], [ 'name' => 'Investor Relations Suite', 'owner' => 'Keith', 'status' => 'pending', 'priority' => 'medium', 'completion' => 22, 'budget' => 9000, 'spent' => 1800, 'due_date' => '2026-06-01', 'phase' => 'Reporting', 'todos_open' => 10, 'todos_done' => 5, ], ] ]; $defaultAccounting = [ 'revenue_streams' => [ ['name' => 'Books', 'amount' => 1200], ['name' => 'Art', 'amount' => 900], ['name' => 'Software / WEB360', 'amount' => 2200], ['name' => 'Services / Consulting', 'amount' => 1500], ], 'expenses' => [ ['name' => 'Hosting', 'amount' => 125], ['name' => 'Domains', 'amount' => 48], ['name' => 'AI APIs', 'amount' => 420], ['name' => 'Design / Assets', 'amount' => 165], ['name' => 'Marketing', 'amount' => 280], ], 'cash_on_hand' => 1330, 'monthly_recurring' => 2400, 'outstanding_debt' => 6300 ]; $defaultAnalytics = [ 'traffic' => [ 'visits_today' => 189, 'visits_7d' => 1320, 'visits_30d' => 5840, 'bounce_rate' => 36.4, 'conversion_rate' => 4.2, 'avg_session_minutes' => 3.8, ], 'channels' => [ ['name' => 'Organic', 'visits' => 2140], ['name' => 'Direct', 'visits' => 1380], ['name' => 'Social', 'visits' => 1170], ['name' => 'Referral', 'visits' => 650], ['name' => 'Paid', 'visits' => 500], ], 'top_pages' => [ ['path' => '/web360/', 'views' => 1240], ['path' => '/simon/', 'views' => 1115], ['path' => '/books/', 'views' => 760], ['path' => '/art/', 'views' => 605], ['path' => '/infinity/', 'views' => 480], ] ]; $defaultSystem = [ 'modules' => [ ['name' => 'SIMON Core', 'status' => 'online'], ['name' => 'WEB360', 'status' => 'online'], ['name' => 'Social Engine', 'status' => 'degraded'], ['name' => 'Accounting', 'status' => 'online'], ['name' => 'Analytics', 'status' => 'online'], ['name' => 'Forecast Engine', 'status' => 'warning'], ['name' => 'API Gateway', 'status' => 'online'], ['name' => 'Security Layer', 'status' => 'healthy'], ], 'server' => [ 'php_version' => PHP_VERSION, 'environment' => 'Production', 'storage_mode' => 'JSON', 'last_sync' => date('Y-m-d H:i:s'), ] ]; /* --------------------------------- LOAD DATA --------------------------------- */ $projectsData = safe_read_json(PROJECTS_FILE, $defaultProjects); $accountingData = safe_read_json(ACCOUNTING_FILE, $defaultAccounting); $analyticsData = safe_read_json(ANALYTICS_FILE, $defaultAnalytics); $systemData = safe_read_json(SYSTEM_FILE, $defaultSystem); /* --------------------------------- PROJECT METRICS --------------------------------- */ $projects = $projectsData['projects'] ?? []; $totalProjects = count($projects); $projectCompletionAvg = avg(array_column($projects, 'completion')); $totalBudget = array_sum(array_map(fn($p) => (float)($p['budget'] ?? 0), $projects)); $totalSpent = array_sum(array_map(fn($p) => (float)($p['spent'] ?? 0), $projects)); $totalOpenTodos = array_sum(array_map(fn($p) => (int)($p['todos_open'] ?? 0), $projects)); $totalDoneTodos = array_sum(array_map(fn($p) => (int)($p['todos_done'] ?? 0), $projects)); $todoCompletion = ($totalOpenTodos + $totalDoneTodos) > 0 ? ($totalDoneTodos / ($totalOpenTodos + $totalDoneTodos)) * 100 : 0; /* --------------------------------- ACCOUNTING METRICS --------------------------------- */ $revenueStreams = $accountingData['revenue_streams'] ?? []; $expenses = $accountingData['expenses'] ?? []; $totalRevenue = array_sum(array_map(fn($r) => (float)($r['amount'] ?? 0), $revenueStreams)); $totalExpenses = array_sum(array_map(fn($e) => (float)($e['amount'] ?? 0), $expenses)); $cashOnHand = (float)($accountingData['cash_on_hand'] ?? 0); $monthlyRecurring = (float)($accountingData['monthly_recurring'] ?? 0); $outstandingDebt = (float)($accountingData['outstanding_debt'] ?? 0); $netMonthly = $totalRevenue - $totalExpenses; /* --------------------------------- ANALYTICS METRICS --------------------------------- */ $traffic = $analyticsData['traffic'] ?? []; $channels = $analyticsData['channels'] ?? []; $topPages = $analyticsData['top_pages'] ?? []; $visitsToday = (int)($traffic['visits_today'] ?? 0); $visits7d = (int)($traffic['visits_7d'] ?? 0); $visits30d = (int)($traffic['visits_30d'] ?? 0); $bounceRate = (float)($traffic['bounce_rate'] ?? 0); $conversionRate = (float)($traffic['conversion_rate'] ?? 0); $avgSession = (float)($traffic['avg_session_minutes'] ?? 0); /* --------------------------------- SYSTEM METRICS --------------------------------- */ $modules = $systemData['modules'] ?? []; $server = $systemData['server'] ?? []; $totalModules = count($modules); $healthyModules = count(array_filter($modules, function ($m) { return in_array(strtolower((string)($m['status'] ?? '')), ['online', 'healthy', 'good', 'stable'], true); })); $moduleHealthPercent = $totalModules > 0 ? ($healthyModules / $totalModules) * 100 : 0; /* --------------------------------- AI FORECAST ENGINE (simple heuristic) --------------------------------- */ $runwayMonths = $totalExpenses > 0 ? $cashOnHand / $totalExpenses : 0; $roiPercent = $totalSpent > 0 ? (($totalRevenue - $totalSpent) / $totalSpent) * 100 : 0; $growthSignal = clamp( ($conversionRate * 8) + ((100 - $bounceRate) * 0.4) + ($projectCompletionAvg * 0.35) + ($moduleHealthPercent * 0.2), 0, 100 ); $forecastRevenue30 = $totalRevenue * (1 + ($growthSignal / 500)); $forecastRevenue90 = $totalRevenue * (1 + ($growthSignal / 220)); $priorityRecommendations = []; if ($totalOpenTodos > 15) { $priorityRecommendations[] = 'Reduce open task backlog by focusing only on high-value milestones this week.'; } if ($totalExpenses > $totalRevenue) { $priorityRecommendations[] = 'Expenses are outpacing revenue. Pause low-ROI spend and strengthen paid conversion tracking.'; } if ($conversionRate < 3.5) { $priorityRecommendations[] = 'Conversion rate is below target. Improve CTA placement, landing page clarity, and offer structure.'; } if ($moduleHealthPercent < 85) { $priorityRecommendations[] = 'System health is below preferred threshold. Stabilize degraded modules before expanding features.'; } if ($projectCompletionAvg > 60 && $totalRevenue < 5000) { $priorityRecommendations[] = 'Product maturity is improving. Shift more effort toward monetization and investor-ready reporting.'; } if (empty($priorityRecommendations)) { $priorityRecommendations[] = 'Current signals are stable. Continue building /projects, /accounting, and /analytics integration into /intelligence.'; } /* --------------------------------- UI FUNCTIONS --------------------------------- */ function metric_card(string $title, string $value, string $sub = '', string $tone = 'neutral'): string { return '
' . h($title) . '
' . h($value) . '
' . h($sub) . '
'; } function progress_bar(float $percent): string { $percent = clamp($percent, 0, 100); return '
'; } ?> <?= h(SIMON_APP_NAME . ' — ' . SIMON_APP_SUBTITLE) ?>

— branded ecosystem dashboard for project tracking, accounting, analytics, AI forecasting, module monitoring, and next-step system guidance.

Projects Accounting Analytics AI Forecast System Health
= 0 ? 'ok' : 'bad') ?> = 85 ? 'ok' : 'warn') ?> = 70 ? 'ok' : 'warn') ?>

Project Command Grid

/projects + cost tracking
Project Status Phase Completion Budget Spent Todos

Owner: · Due:
%
Open / Done
Average Completion
Total Budget
Todo Completion

Accounting Overview

/accounting
Revenue stream
Revenue
Expenses
Cash On Hand

Expense Breakdown

monthly ops
Operating expense
Recurring
Debt
Runway
mo

Traffic Analytics

/analytics
Today
7 Days
30 Days
Bounce Rate
Conversion
Avg Session
m

Top Pages

site performance
views
Tracked page traffic

Channel Mix

traffic sources

System Module Health

/system monitor
Live ecosystem status

AI Forecast Engine

/intelligence
ROI Signal
30 Day Forecast
90 Day Forecast

Server Snapshot

runtime
PHP Version
Environment
Storage
Last Sync
Data Directory